package com.atguigu.gmall.pms.api;

import com.atguigu.gmall.common.bean.PageParamVo;
import com.atguigu.gmall.common.bean.ResponseVo;
import com.atguigu.gmall.pms.entity.*;
import com.atguigu.gmall.pms.vo.ItemGroupVo;
import com.atguigu.gmall.pms.vo.SaleAttrValueVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

public interface GmallPmsApi {

    @PostMapping("pms/spu/page")
    @ApiOperation("ES 远程访问传输文档分页查询Spu数据")
    public ResponseVo<List<SpuEntity>> querySpuByPageJson(@RequestBody PageParamVo paramVo);


    @GetMapping("pms/sku/spu/{spuId}")
    @ApiOperation("ES 远程访问传输文档 根据SpuId 查询SKu信息")
    public ResponseVo<List<SkuEntity>> querySkuBySpuId(@PathVariable("spuId")Long sid);

    @GetMapping("pms/sku/{id}")
    @ApiOperation("根据skuId 查询sku的详细信息")
    public ResponseVo<SkuEntity> querySkuById(@PathVariable("id") Long id);

    @GetMapping("pms/skuimages/sku/{skuId}")
    @ApiOperation("根据SkuId查询旗下所有图片信息")
    public ResponseVo<List<SkuImagesEntity>> querySkuImagesBySid(@PathVariable("skuId") Long skuId);


    @GetMapping("pms/brand/{id}")
    @ApiOperation("根据brandId查询商品信息")
    public ResponseVo<BrandEntity> queryBrandById(@PathVariable("id") Long id);


    @GetMapping("pms/category/{id}")
    @ApiOperation("根据分类id详情查询")
    public ResponseVo<CategoryEntity> queryCategoryById(@PathVariable("id") Long id);

    @GetMapping("pms/category/all/{id}")
    @ApiOperation("根据三级分类id查询获得一二三级分类信息")
    public ResponseVo<List<CategoryEntity>> categories123ByCid3(@PathVariable("id") Long id);

    @ApiOperation("获取商品三级分类")
    @GetMapping("pms/category/parent/{parentId}")
    public ResponseVo<List<CategoryEntity>> categoryByPid(@PathVariable("parentId")Long pid);

    @GetMapping("pms/category/subs/{pid}")
    @ApiOperation("获取商品二级分类及旗下的三级分类")
    public ResponseVo<List<CategoryEntity>> categoriesWithSubsByPid(@PathVariable("pid") Long pid);


    @GetMapping("pms/skuattrvalue/category/{cid}")
    @ApiOperation("根据cid 和 SkuId查询销售属性  隐含条件search_type=1")
    public ResponseVo<List<SkuAttrValueEntity>> querySearchSkuAttrValueByCidAndSkuId(
            @PathVariable("cid")Long cid,@RequestParam Long skuId);

    @GetMapping("pms/skuattrvalue/spu/{spuId}")
    @ApiOperation("根据spuId查询spu下所有sku的销售属性")
    public ResponseVo<List<SaleAttrValueVo>> querySkuSaleAttrValueBySpuId(@PathVariable("spuId")Long spuId);

    @GetMapping("pms/skuattrvalue/sku/{skuId}")
    @ApiOperation("根据skuId查询sku的销售属性")
    public ResponseVo<List<SkuAttrValueEntity>>  querySaleAttrValuesBySkuId(@PathVariable("skuId")Long skuId);

    @GetMapping("pms/spuattrvalue/category/{cid}")
    @ApiOperation("根据cid 和 SpuId查询基本属性  隐含条件search_type=0")
    public ResponseVo<List<SpuAttrValueEntity>> querySearchSpuAttrValueByCidAndSpuId(
            @PathVariable("cid")Long cid,@RequestParam Long spuId);


    @GetMapping("pms/spu/{id}")
    @ApiOperation("根据SpuId  查询Spu信息  用于ES 消息队列使用保存spu信息")
    public ResponseVo<SpuEntity> querySpuById(@PathVariable("id") Long id);

    @GetMapping("pms/spudesc/{spuId}")
    @ApiOperation("根据spuId查询spuDesc详细信息")
    public ResponseVo<SpuDescEntity> querySpuDescById(@PathVariable("spuId") Long spuId);

    @GetMapping("pms/skuattrvalue/mapping/{spuId}")
    @ApiOperation("根据spuId查询spu下所有销售属性与skuId的映射关系map")
    public ResponseVo<String> querySaleWithSkuIdMappingBySpuId(@PathVariable("spuId")Long spuId);

    @GetMapping("pms/attrgroup/with/attr/value/{cid}")
    @ApiOperation("根据分类id，skuId，spuId查询分组及组下的规格参数和值")
    public ResponseVo<List<ItemGroupVo>> queryGroupWithAttrAndValueByCidAndSpuIdAndSkuId(
            @PathVariable("cid")Long cid,
            @RequestParam("skuId")Long skuId,
            @RequestParam("spuId")Long spuId);

}
